package snackfind.sjoerd.job;

import android.app.Activity;
import android.os.Bundle;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.RatingBar.OnRatingBarChangeListener;

public class Review extends Activity {
	float aantal = 0;
	float gemidcijfer=0;
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.review);
        
        final TextView ratingcijfer = (TextView) findViewById(R.id.rating);
        
        final RatingBar ratingbar = (RatingBar) findViewById(R.id.ratingbar);
        ratingbar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
            public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
            	aantal = aantal+1;
            	gemidcijfer = gemidcijfer +(rating*2);
            	float cijfer = gemidcijfer/aantal;
            	String a = Float.toString(cijfer);
                ratingcijfer.setText("Cijfer: "+a);
            }
        });
    }
}
